<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js0201</title>
    <style>
        div{
            text-align: center;
        }
    </style>
</head>
<body>
<script>
    var sum = 0;
    for (i = 1; i <= 100; i++) {
        sum += i;
    }
    document.write('1+2+3+...+100=' + sum);
    document.write('<hr><br><br>');
    for(i=1;i<=30;i+=2){
        document.write('<div>');
        for(j=1;j<=i;j++){
            document.write('*')
        }
        document.write('</div>');
    }
    for(i=31;i>=1;i-=2){
        document.write('<div>');
        for(j=1;j<=i;j++){
            document.write('*')
        }
        document.write('</div>');
    }
</script>
</body>
</html>